package ae.pcfc.etks.online.itworx.ehs.web.delegate.impl;

import java.util.List;

import ae.pcfc.etks.online.itworx.ehs.web.delegate.EHSDelegate;
import ae.pcfc.etks.online.itworx.ehs.web.entity.DocumentType;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCDocument;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus;
import ae.pcfc.etks.online.itworx.ehs.web.exception.DocumentTypeAlraedyExistException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.DocumentTypeNotFoundException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.InvalidDocumentTypeNameException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.InvalidInputException;
import ae.pcfc.etks.online.itworx.ehs.web.facade.EHSFacade;

public class EHSDelegateImpl extends BaseDelegateImpl implements EHSDelegate {

	@Override
	public List<DocumentType> getAllDocumentType() {
		return serviceLocator.getFacadeService(EHSFacade.class)
				.getAllDocumentType();
	}

	@Override
	public void createNewDocumentType(DocumentType documentType)
			throws DocumentTypeAlraedyExistException,
			InvalidDocumentTypeNameException, InvalidInputException, RuntimeException {

		serviceLocator.getFacadeService(EHSFacade.class).createNewDocumentType(
				documentType);

	}
	@Override
	public DocumentType getDocumentTypeById(Long id)
		throws DocumentTypeNotFoundException, InvalidInputException{
		return serviceLocator.getFacadeService(EHSFacade.class)
				.getDocumentTypeById(id);

	}

	@Override
	public void deleteDocumentType(Long id)
			throws DocumentTypeNotFoundException, InvalidInputException {

		serviceLocator.getFacadeService(EHSFacade.class).deleteDocumentType(id);

	}

	@Override
	public void updateDocumentType(DocumentType documentType)
			throws DocumentTypeNotFoundException, InvalidInputException,
			InvalidDocumentTypeNameException, DocumentTypeAlraedyExistException, RuntimeException {

		serviceLocator.getFacadeService(EHSFacade.class).updateDocumentType(
				documentType);

	}

//	@Override
//	public DocumentType retrieveDocumentTypeByName(String name, Long id) {
//		return serviceLocator.getFacadeService(EHSFacade.class)
//				.retrieveDocumentTypeByName(name, id);
//
//	}

	@Override
	public OFCDocument findOFCDocumentById(long id)
			throws InvalidInputException {
		return serviceLocator.getFacadeService(EHSFacade.class)
		.findOFCDocumentById(id);
	}
	
	@Override
	public List<DocumentType> getAllDocumentTypeByOFCStatus(
			String documentName, RequestStatus requestStatus) {
		return serviceLocator.getFacadeService(EHSFacade.class)
		.getAllDocumentTypeByOFCStatus(documentName, requestStatus);
	}
	
	
}
